package activity.local;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

public class ActivityActivity extends Activity implements OnClickListener {
	
	Button bt01, bt02, bt03, bt04, bt05, bt06, bt07, bt08;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        bt01 = (Button) findViewById(R.id.Button01);
        bt01.setOnClickListener(this);
        
        bt02 = (Button) findViewById(R.id.Button02);
        bt02.setOnClickListener(this);
        
        bt03 = (Button) findViewById(R.id.Button03);
        bt03.setOnClickListener(this);
        
        bt04 = (Button) findViewById(R.id.Button04);
        bt04.setOnClickListener(this);
        
        bt05 = (Button) findViewById(R.id.Button05);
        bt05.setOnClickListener(this);
        
        bt06 = (Button) findViewById(R.id.Button06);
        bt06.setOnClickListener(this);
        
        bt07 = (Button) findViewById(R.id.Button07);
        bt07.setOnClickListener(this);
        
        bt08 = (Button) findViewById(R.id.Button08);
        bt08.setOnClickListener(this);
        
    }

	public void onClick(View v) {
		Intent intent;
		if(v==bt01){
			intent = new Intent(Intent.ACTION_VIEW);
			intent.setData(Uri.parse("http://www.google.com"));
			this.startActivity(intent);
		}
		
		if(v==bt02){
			intent = new Intent(Intent.ACTION_CALL,
					Uri.parse("tel:(+49)12345789"));
			this.startActivity(intent);
		}
		
		if(v==bt03){
			intent = new Intent(Intent.ACTION_DIAL,
					Uri.parse("tel:(+49)12345789"));
			this.startActivity(intent);
		}
		
		if(v==bt04){
			intent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("geo:50.123,7.1434?z=19"));
			this.startActivity(intent);
		}
		
		if(v==bt05){
			intent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("geo:0,0?q=query"));
			this.startActivity(intent);
		}
		
		if(v==bt06){
			intent = new Intent("android.media.action.IMAGE_CAPTURE");
			startActivityForResult(intent, 0);
			this.startActivity(intent);
		}
		
		if(v==bt07){
			intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/"));
			startActivity(intent);
			this.startActivity(intent);
		}
		
		if(v==bt08){
			intent = new Intent(Intent.ACTION_EDIT, Uri.parse("content://contacts/people/1"));
			startActivity(intent);
			this.startActivity(intent);
		}
		
	}
}